import java.io.BufferedReader;
import java.io.FileReader;
import java.io.IOException;
import java.io.PrintWriter;
import java.util.StringTokenizer;

public class Holes implements Runnable {
    private void solve() {
		int height = nextInt();
		int width = nextInt();
		int numHoles = nextInt();
		boolean[][] hole = new boolean[height][width];
		for (int i = 0; i < numHoles; ++i) {
			int row = nextInt() - 1;
			int col = nextInt() - 1;
			hole[row][col] = true;
		}
		int[][] res = new int[height][width];
		{
			int at = 0;
			int[] sRow = new int[height * width];
			int[] sCol = new int[height * width];
			for (int row = 0; row < height; ++row) {
				if (row % 2 == 0) {
					for (int col = 0; col < width; ++col) {
						sRow[at] = row;
						sCol[at] = col;
						++at;
					}
				} else {
					for (int col = width - 1; col >= 0; --col) {
						sRow[at] = row;
						sCol[at] = col;
						++at;
					}
				}
			}
			if (at != height * width) throw new RuntimeException();
			int lastHole = -1;
			for (int i = 0; i < height * width; ++i) {
				if (hole[sRow[i]][sCol[i]]) {
					for (int j = lastHole + 1; j <= i; ++j) {
						if (sRow[j] % 2 == 0)
							res[sRow[j]][sCol[j]] = i - j;
					}
					lastHole = i;
				}
			}
			for (int j = lastHole + 1; j < height * width; ++j) {
				if (sRow[j] % 2 == 0)
					res[sRow[j]][sCol[j]] = (height * width - 1 - lastHole) + (height * width - 1 - j);
			}
		}
		{
			int at = 0;
			int[] sRow = new int[height * width];
			int[] sCol = new int[height * width];
			for (int row = 0; row < height; ++row) {
				if (row % 2 != 0) {
					for (int col = 0; col < width; ++col) {
						sRow[at] = row;
						sCol[at] = col;
						++at;
					}
				} else {
					for (int col = width - 1; col >= 0; --col) {
						sRow[at] = row;
						sCol[at] = col;
						++at;
					}
				}
			}
			if (at != height * width) throw new RuntimeException();
			int lastHole = -1;
			for (int i = 0; i < height * width; ++i) {
				if (hole[sRow[i]][sCol[i]]) {
					for (int j = lastHole + 1; j <= i; ++j) {
						if (sRow[j] % 2 != 0)
							res[sRow[j]][sCol[j]] = i - j;
					}
					lastHole = i;
				}
			}
			for (int j = lastHole + 1; j < height * width; ++j) {
				if (sRow[j] % 2 != 0)
					res[sRow[j]][sCol[j]] = (height * width - 1 - lastHole) + (height * width - 1 - j);
			}
		}
		for (int row = 0; row < height; ++row) {
			for (int col = 0; col < width; ++col) {
				if (col > 0) writer.print(" ");
				writer.print(res[row][col]);
			}
			writer.println();
		}
    }

    public static void main(String[] args) {
        new Holes().run();
    }

    BufferedReader reader;
    StringTokenizer tokenizer;
    PrintWriter writer;

    static final String TASK_ID = "holes";

    public void run() {
        try {
            reader = new BufferedReader(new FileReader(TASK_ID + ".in"));
            tokenizer = null;
            writer = new PrintWriter(TASK_ID + ".out");
            solve();
            reader.close();
            writer.close();
        } catch (Exception e) {
            throw new RuntimeException(e);
        }
    }

    int nextInt() {
        return Integer.parseInt(nextToken());
    }

    long nextLong() {
        return Long.parseLong(nextToken());
    }

    double nextDouble() {
        return Double.parseDouble(nextToken());
    }

    String nextToken() {
        while (tokenizer == null || !tokenizer.hasMoreTokens()) {
            try {
                tokenizer = new StringTokenizer(reader.readLine());
            } catch (IOException e) {
                throw new RuntimeException(e);
            }
        }
        return tokenizer.nextToken();
    }
}
